﻿using System;
using System.Security.Cryptography;

namespace CSharpHelpers.Randoms
{
    public class RNGProvider
    {
        private static readonly RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider();
        private static byte[] bytes = new byte[4];

        /// <summary>
        /// 加密随机数生成器，生成随机种子
        /// </summary>
        /// <returns></returns>
        public static int Chaos_GetRandomSeed()
        {
            rng.GetBytes(bytes);
            return BitConverter.ToInt32(bytes, 0);
        }
    }
}
